﻿using System;

namespace FDEE.Model
{
    public class MHXSRebarRecord : RebarBase
    {
        public int L;
        public bool IsInternal;

        /// <summary>
        /// MHX钢筋，墩身预埋至承台主筋，总长9m固定。
        /// </summary>
        /// <param name="mBarMark">钢筋主编号，例如1</param>
        /// <param name="sBarMark">钢筋次编号，例如1.1，默认为0</param>
        /// <param name="cBarMark">钢筋字符编号，例如1a，默认为空</param>
        /// <param name="diameter">钢筋直径，按eDB选取</param>
        /// <param name="isInternal">是否为内扣起步筋</param>
        /// <param name="quantity">数量</param>
        /// <param name="shapeConfig"></param>
        public MHXSRebarRecord(int mBarMark, int sBarMark, string cBarMark, eDB diameter,
            bool isInternal,
            int quantity, eShapeType shapeConfig, int b, int c=1500,  int a = 600)
            : base(mBarMark, sBarMark, cBarMark, diameter, quantity, shapeConfig)
        {

            A = a;        //固定      
            B = b;
            C = c;         //固定       
            this.r = RebarKnowledge.GerRadius(diameter);
            this.d = PublicEnumItems.GeteDBData(diameter.ToString());


            IsInternal = isInternal;// 是否为内扣钢筋;
            this.Formula = "L=A+B+C-r/2-d";
        }
        public override void SetLength()
        {
            Length = A + B + C  - r / 2 - d;
            Length = Math.Round(Length * 0.001, 3, MidpointRounding.AwayFromZero);
        }
    }
    public class MHXLRebarRecord : RebarBase
    {
        public int L;
        public bool IsInternal;

        /// <summary>
        /// MHX钢筋，墩身预埋至承台主筋，总长9m固定。
        /// </summary>
        /// <param name="mBarMark">钢筋主编号，例如1</param>
        /// <param name="sBarMark">钢筋次编号，例如1.1，默认为0</param>
        /// <param name="cBarMark">钢筋字符编号，例如1a，默认为空</param>
        /// <param name="diameter">钢筋直径，按eDB选取</param>
        /// <param name="isInternal">是否为内扣起步筋</param>
        /// <param name="quantity">数量</param>
        /// <param name="shapeConfig"></param>
        public MHXLRebarRecord(int mBarMark, int sBarMark, string cBarMark, eDB diameter,
            bool isInternal,
            int quantity, eShapeType shapeConfig, int b,int c,int d,int a=600)
            : base(mBarMark, sBarMark, cBarMark, diameter, quantity, shapeConfig)
        {
           
            A = a;        //固定      
            B = b;
            C = c;         //固定
            D = d;       //固定         
            this.r = RebarKnowledge.GerRadius(diameter);
            this.d = PublicEnumItems.GeteDBData(diameter.ToString());

      
            IsInternal = isInternal;// 是否为内扣钢筋;
            this.Formula = "L=A+B+C+D-r/2-d";
        }
        public override void SetLength()
        {
            Length = A + B + C + D - r / 2 - d;
            Length = Math.Round(Length * 0.001, 3, MidpointRounding.AwayFromZero);
        }
    }
    public class MHXRebarRecord : RebarBase
    {
        public int  L;
        public bool IsInternal;

        /// <summary>
        /// MHX钢筋，墩身预埋至承台主筋，总长9m固定。
        /// </summary>
        /// <param name="mBarMark">钢筋主编号，例如1</param>
        /// <param name="sBarMark">钢筋次编号，例如1.1，默认为0</param>
        /// <param name="cBarMark">钢筋字符编号，例如1a，默认为空</param>
        /// <param name="diameter">钢筋直径，按eDB选取</param>
        /// <param name="isInternal">是否为内扣起步筋</param>
        /// <param name="quantity">数量</param>
        /// <param name="shapeConfig"></param>
        public MHXRebarRecord(int mBarMark, int sBarMark, string cBarMark, eDB diameter,
            bool isInternal ,
            int quantity, eShapeType shapeConfig,int len=9000,int dd=2400)
            :base(mBarMark,sBarMark,cBarMark,diameter,quantity,shapeConfig)
        {
            if (diameter == eDB.DB28)
                dd = 1800;
            A = 600;        //固定      
            C = 250;         //固定
            //C = 45;         //固定
            D = dd;       //固定
            L = len;       //固定
         
            this.r = RebarKnowledge.GerRadius(diameter);
            this.d = (int)diameter;
            B = L - A - C - D + r / 2 + d;
            IsInternal = isInternal;// 是否为内扣钢筋;
            this.Formula = "L=A+B+C+D-r/2-d";
        }
        public override void SetLength()
        {
            Length = Math.Round(L *0.001, 3, MidpointRounding.AwayFromZero);
        }
    }
    public class MHXARebarRecord : RebarBase
    {
        public int L;
        public bool IsInternal;

        /// <summary>
        /// MHX钢筋，墩身预埋至承台主筋，总长9m固定。
        /// </summary>
        /// <param name="mBarMark">钢筋主编号，例如1</param>
        /// <param name="sBarMark">钢筋次编号，例如1.1，默认为0</param>
        /// <param name="cBarMark">钢筋字符编号，例如1a，默认为空</param>
        /// <param name="diameter">钢筋直径，按eDB选取</param>
        /// <param name="isInternal">是否为内扣起步筋</param>
        /// <param name="quantity">数量</param>
        /// <param name="shapeConfig"></param>
        public MHXARebarRecord(int mBarMark, int sBarMark, string cBarMark, eDB diameter,
            bool isInternal,
            int quantity, eShapeType shapeConfig, int len = 7000, int dd = 2400)
            : base(mBarMark, sBarMark, cBarMark, diameter, quantity, shapeConfig)
        {
            A = 600;        //固定      
            L = len;       //固定
            this.r = RebarKnowledge.GerRadius(diameter);
            this.d = (int)diameter;
            B = L - A + r / 2 + d;
            IsInternal = isInternal;// 是否为内扣钢筋;
            this.Formula = "L=A+B-r/2-d";
        }
        public override void SetLength()
        {
            Length = Math.Round(L * 0.001, 3, MidpointRounding.AwayFromZero);
        }
    }
}
